<?php

namespace app\api\controller\wdsxh\single;
use app\common\controller\Api;
use  app\admin\model\wdsxh\mall\Banner as Model;

/**
 * 轮播图管理
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];
//轮播图
    public function banner(){
        $list=Model::where('status',1)
            ->order('weigh desc')
            ->field('id,title,image,jump_type as nav_type,content')
            ->select();
        if($list){
            $list=collection($list)->toArray();
            foreach ($list as &$row){
                $row['image']=wdsxh_full_url($row['image']);
                if($row['nav_type'] == 2){
                    $row['content']=json_decode($row['content'],true);
                }
            }
        }
        $this->success('请求成功',$list);
    }
}